@extends('admin.layouts.admin')

@section('content')
    <h1>Articles</h1>
    <div class="panel panel-info">
        <div class="panel-heading">Liste des articles</div>
        <div class="table-responsive">
            <table class="table table-striped table-hover">
                <thead>
                        <th>Titre</th>
                        <th>Parent</th>
                        <th>Take action !</th>
                </thead>
                <tbody>
                @foreach($BGs as $bg)
                    <tr>
                        <td>{{$bg->titre}}</td>
                        @if(isset($BGs[$bg->parent_id-1]))
                            <td>{{$BGs[$bg->parent_id-1]->titre}}</td>
                        @else
                            <td>&nbsp;</td>
                        @endif
                        <td>
                            <a href="{{URL::route('admin-get-edit-article', $bg->article_id)}}" class="btn btn-primary">
                                <span class="glyphicon glyphicon-edit"></span>
                                Editer
                            </a>
                            <a href="{{URL::route('admin-delete-article', $bg->article_id)}}" class="btn btn-danger">
                                <span class="glyphicon glyphicon-remove"></span>
                                Supprimer
                            </a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
    <a href="{{ URL::route('admin-add-article') }}" class="btn btn-primary">
        <span class="glyphicon glyphicon-edit"></span>
        Ajouter un texte
    </a>
@stop
